<!doctype html>
<html>
<head>
<title>Login</title> <#assign basePath=request.contextPath>
<link rel="shortcut icon" href="${basePath}/favicon.ico">
<link rel="icon" type="image/gif" href="${basePath}/animated_favicon.gif">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta charset="utf-8">
<script type="text/javascript">
	var _basePath = '${basePath}';
</script>
<link rel="stylesheet" href="http://cdn.bootcss.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link rel=stylesheet type=text/css href="${basePath}/res/login/login.css" />
<script src="http://cdn.bootcss.com/jquery/2.1.3/jquery.js"></script>
<script src="//cdn.bootcss.com/jquery.qrcode/1.0/jquery.qrcode.min.js"></script>
<script type="text/javascript">
function login(){
	var code = $("[name='code']").val();
	var password = $("[name='password']").val();
	jQuery.ajax({
		url : "${basePath}/login",
		data:{code:code,password:password},
		type : "POST",
		dataType : "json",
		success : function(json){
			if(json.flag){
				window.location.href = '${basePath}/admin';
			}else{
				alert(json.msg);
			}
		}
	});
}
$(function(){
    jQuery('#qrcode').qrcode({width:150,height:150,correctLevel:0,text:toUtf8("看你傻的..还没做好呢，只能测试一下。。。")});  
});
function toUtf8(str) {    
    var out, i, len, c;    
    out = "";    
    len = str.length;    
    for(i = 0; i < len; i++) {    
        c = str.charCodeAt(i);    
        if ((c >= 0x0001) && (c <= 0x007F)) {    
            out += str.charAt(i);    
        } else if (c > 0x07FF) {    
            out += String.fromCharCode(0xE0 | ((c >> 12) & 0x0F));    
            out += String.fromCharCode(0x80 | ((c >>  6) & 0x3F));    
            out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));    
        } else {    
            out += String.fromCharCode(0xC0 | ((c >>  6) & 0x1F));    
            out += String.fromCharCode(0x80 | ((c >>  0) & 0x3F));    
        }    
    }    
    return out;    
}
</script>
</head>
<body id="loginFrame">
	<div id="header">
		<div id="logo">
			<a></a>
		</div>
	</div>
	<div id="loginBox">
		<div id="loginBoxHeader"></div>
		<div id="loginBoxBody">
			<ul class="floatLeft">
				<li>
					<h4>请用您的注册账号登录</h4>
				</li>
				<li>
					<p>帐号:</p> <input type="text" name="code" size="30" maxlength="16" class="textInput" value="admin" autocomplete="off">
				</li>
				<li>
					<p>密码:</p> <input type="password" name="password" size="30" maxlength="80" class="textInput" value="1" autocomplete="off"> <a
					target="_blank" href="" class="highlight">忘记密码？</a>
				</li>
				<li class="highlight"><input type="button" value="登录" onclick="login();" id="loginBtn" /> <a target="_blank" href="" id="regBtn">注册新账号</a>
				</li>
				<li>其他登录方式： <a href="${qqLoginUrl}"><img src="${basePath}/res/login/qq.png" /></a>
				</li>
			</ul>
			<div class="floatRight">
				欢迎登录${ws['ws_name']}后台管理。<br />
				<div id="qrcode" style="width: 150px;height: 150px;"></div>
			</div>
			<br clear="all">
		</div>
		<div id="loginBoxFooter"></div>
	</div>
	<div id="footer">
		<a target="_blank" href="http://www.dowdybear.com" style="color: #fff"><i class="fa fa-copyright"></i> ${ws['ws_name']}</a>
	</div>
</body>